﻿using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace DISP.Test.TestSuite.Mocks
{
    public class HttpRequestMock
    {
        public Moq.Mock<HttpContextBase> HttpContext { get; set; }
        public Moq.Mock<HttpRequestBase> Request { get; set; }
        public RouteData RouteData { get; set; }

        public HttpRequestMock(ControllerBase controller)
        {
            //define context objects
            HttpContext = new Moq.Mock<HttpContextBase>();
            HttpContext.Setup(x => x.Request).Returns(Request.Object);
            //you would setup Response, Session, etc similarly with either mocks or fakes

            //apply context to controller
            var rc = new RequestContext(HttpContext.Object, new RouteData());
            controller.ControllerContext = new ControllerContext(rc, controller);
        }

    }
}
